<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>methods</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        直接在html模板标签中调用
        {{say()}}
        {{add}}
    </div>
</body>
    <script type="text/javascript">

        var app=new Vue({
            el:"#app",
            data:{
                user: {
                    name: "老王",
                    age: 18,
                    color: "pink"
                },
                a:20,
                b:30
            },
            //计算属性
            computed:{
                add:function (){
                return this.a+this.b;
                }
            },
            methods:{//方法区
                say(){
                    return "hello:"+this.user.name
                },
                swim(){
                    console.log("游泳游泳")
                }
            }
        })
        //通过vue对象调用
        app.swim();
    </script>
</html>